<include file="Index:header"/>
<import file="Common.uploadify.uploadify" type="css"/>
<import file="Common.uploadify.jquery#uploadify#min"/>
<style>
.banner-img {
	width:120px;
	height:auto;
}
</style>
<div id="content" class="container_16 clearfix">
	<div class="btn-toolbar">
			<div id="addBtn"></div>
	</div>
	
	<div class="well">
			<table class="table" id="blist">
				<thead>
					<tr>
						<th>图片</th>
						<th>路径</th>
						<th>删除</th>
					</tr>
				</thead>
				<tbody>
					<volist name="banners" id="banner">
						<tr>
							<td><img src="<empty name='banner.thumb'>{$banner.path}<else />{$banner.thumb}</empty>" class="img-polaroid banner-img" /></td>
							<td>{$banner.path}</td>
							<td>
								<a href="#" ctype='drop' acturl="{:U('Admin/Banner/delete',array('id'=>$banner['id']))}" role="button"><i class="icon-remove"></i></a>
							</td>
						</tr>
					</volist>
				</tbody>		
			</table>
		
	</div>
</div>
<script type="text/javascript">
$(function() {
    $("#addBtn").uploadify({
    	'buttonText' : '添加图片',
    	'buttonClass': '',
        'swf'      : '__PUBLIC__/Common/uploadify/uploadify.swf',
        'uploader' : '{:U("Admin/Banner/add")}',
        'onUploadSuccess' : function(file, data, response) {
            var jsonData = JSON.parse(data);
            if( jsonData.error==0 ){
            	window.location.reload();
            	showsuccess('上传成功');
            }
            else{
            	showerror('上传失败');
            }
        } 
    });
});
</script>

<include file="Index:footer"/>